<?php


namespace app\admin\validate;


use think\Validate;

class PartnerAdmin extends Validate
{
    //字段规则
    protected $rule = [
        'username' => 'require|unique:partner_admin',
        'partner_id' => 'require',
        'password' => 'require',
        'rule' => 'require',
    ];

    //验证器提示信息
    protected $message = [
        'username.require' => '请输入用户名',
        'username.unique' => '用户名已经存在',
        'password.require' => '请输入密码',
        'password.rule' => '角色必须',
    ];

    //使用场景
    protected $scene = [
        'add'  =>  ['username','password','partner_id','rule'],
        'edit'   => ['username' => 'require','partner_id','rule']
    ];
}